<?php
/**
 * Created by PhpStorm.
 * User: hang
 * Date: 2021/12/15
 * Time: 10:38
 */
include_once '../tools/DbTools.php';
include_once '../user/common.php';
$is_login = getLoginStatus();
if (empty($is_login)){
    echo '尚未登录，<a href="../user/loginUi.php">去登陆</a>';
    die;
}else{
    session_start();
    $token = $_COOKIE['Token'];
    $userInfo = $_SESSION[$token];
    $CardId = $userInfo['CardId'];
    $inMoney = $_POST['inMoney'];
    DbTools::initDb();
    $sql = "update bankcard set CardMoney=CardMoney+$inMoney where CardId='$CardId'";
    DbTools::noSelect($sql);
    DbTools::close();
    echo "<h2>存钱成功！<br/><a href=\"moneyIn.php\">继续存钱</a><br/><a href=\"../user/userInfo.php\">用户中心</a></h2>";
}